<?php

use yii\db\Migration;

/**
 * Class m190424_061933_wx_card_consume
 */
class m190424_061933_wx_card_consume extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
        $this->createTable('wx_card_consume', [
            'id'           => $this->primaryKey()->notNull()->unsigned()->comment('微信卡券核销主键id'),
            'orderid'      => $this->string(32)->notNull()->defaultValue('')->comment('卡券核销的订单ID'),
            'card_id'      => $this->string(64)->notNull()->defaultValue('')->comment('卡券批次ID'),
            'code'         => $this->string(32)->notNull()->defaultValue('')->comment('卡券code码'),
            'openid'       => $this->string(64)->notNull()->defaultValue('')->comment('用户的openid'),
            'add_time'     => $this->integer(10)->notNull()->defaultValue(0)->comment('核销时间'),
        ], $tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m190424_061933_wx_card_consume cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m190424_061933_wx_card_consume cannot be reverted.\n";

        return false;
    }
    */
}
